package chapter03

import scala.beans.BeanProperty

/**
 * @program lu-scala01
 * @description: scala默认public，public属性，底层实际还是private，
 *  并通过get、set方法对其进行操作，故Scala不推荐设置属性为private
 * @author: zhanglu
 * @create: 2022-03-08 16:41:00
 */
object C03_Class {

  def main(args: Array[String]): Unit = {
    val student = new Student
    println(student.getAge)
    println(student.sex)
    student.sex = "男"
    println(student.sex)
  }

}

class Student{

  private var name: String = "lu"
  @BeanProperty
  val age: Int = 18
  var sex: String = _

}
